package cn.study.controller;


import cn.study.entity.StudyFavorite;
import cn.study.service.StudyFavoriteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author qiao
 * @since 2020-07-13
 */

@Controller
@RequestMapping("/study-favorite")
public class StudyFavoriteController {
    @Resource
    StudyFavoriteService studyFavoriteService;

    @ResponseBody
    @GetMapping("details")
    public String Add(Model model, @RequestParam("studyEmpId") Integer studyEmpId, @RequestParam("studyCourseId") Integer studyCourseId) {
        StudyFavorite studyFavorite = new StudyFavorite();
        studyFavorite.setStudyEmpId(studyEmpId);
        studyFavorite.setStudyCourseId(studyCourseId);
        boolean bl = studyFavoriteService.save(studyFavorite);
        if (bl) {
            return "收藏成功！";
        } else {
            return "收藏失败！";
        }

    }
}

